package com.example.win.android_banduyujia.peopleactivity.ui.activity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Win on 2015/8/6.
 */
public class BaseTitleBarActivity extends BaseActivity {
    private TitleActionBarHelper mTitleActionBarHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mTitleActionBarHelper = new TitleActionBarHelper(this);
        mTitleActionBarHelper.onCreate();
    }

    @Override
    public void setContentView(int layoutResID) {
        setContentView(getLayoutInflater().inflate(layoutResID, null));
    }

    @Override
    public void setContentView(View view, ViewGroup.LayoutParams params) {
        setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    }

    @Override
    public void setContentView(View view) {
        super.setContentView(view);
        mTitleActionBarHelper.initTitle();
        setTitle(getTitle());
    }

    @Override
    public void setTitle(int titleId) {
        mTitleActionBarHelper.setBigTitleById(titleId);
    }

    @Override
    public void setTitle(CharSequence title) {
        mTitleActionBarHelper.setBigTitle(title.toString());
    }

    public void showLeftBackButton(){
        mTitleActionBarHelper.showBackButton(false);
    }

    public void setRightButtonImageAndListener(int imageId, View.OnClickListener listener){
        mTitleActionBarHelper.setRightButtonImageAndListener(imageId, listener);
    }

    public void setRightTextViewListener(int textId, View.OnClickListener listener){
        mTitleActionBarHelper.setRightTextViewListener(textId, listener);
    }
}
